﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace IntelliTouchMix
{
    public enum Panels
    {
        DECK_A,
        DECK_B,
        LIBRARY,
        INDICATORS,
        RIBBON
    }

    class Util
    {
        public static int NONE = -1;

        public static int DECK_A = 0;
        public static int DECK_B = 1;
        public static int LIBRARY = 2;
        public static int INDICATORS = 3;
        public static int RIBBON = 4;

        public static int DECK_WAVE_FULL = 0;
        public static int DECK_WAVE_SCROLL = 1;
        public static int DECK_VOLUME = 2;
        public static int DECK_TEMPO = 3;
        public static int DECK_RATE = 4;

        public static int LIBRARY_CATEGORY = 0;
        public static int LIBRARY_CATEGORY_SONGS = 1;
        public static int LIBRARY_SELECTED = 2;
        public static int LIBRARY_SEARCH = 3;

        public static int INDICATORS_2_FINGERS_CATEGORY = 0;
        public static int INDICATORS_2_FINGERS_EFFECT = 1;
        public static int INDICATORS_3_FINGERS_CATEGORY = 2;
        public static int INDICATORS_3_FINGERS_EFFECT = 3;
        public static int INDICATORS_MATERIAL_CATEGORY = 4;
        public static int INDICATORS_MATERIAL_EFFECT = 5;
        public static int INDICATORS_SAMPLE1_CATEGORY = 6;
        public static int INDICATORS_SAMPLE1_BANK = 7;
        public static int INDICATORS_SAMPLE2_CATEGORY = 8;
        public static int INDICATORS_SAMPLE2_BANK = 9;
        public static int INDICATORS_SCRATCH = 10;
        public static int INDICATORS_SNAP_ONOFF = 11;
        public static int INDICATORS_SNAP_SIZE = 12;

        public static int RIBBON_MUSIC = 0;
        public static int RIBBON_TOUCHMODE = 1;
        public static int RIBBON_MIX = 2;
        public static int RIBBON_INTELLIMIX = 3;
        public static int RIBBON_EFFECTS = 4;
        public static int RIBBON_SETTINGS = 5;

        public static short PLAYER1 = 0;
        public static short PLAYER2 = 1;
        public static short MONITOR_PLAYER = 2;
        public static short PREVIEW_PLAYER = 3;

        public static int CHANGE_CONTROL_WITH_UP_DOWN = 0;
        public static int CHANGE_CONTROL_WITH_LEFT_RIGHT = 1;

        public static Form[] panelForm;

        public static int[] panelControllingType;

        public static Rectangle[][] controllContourPosition;

        public static int reportTimeLimit = 50;
        public static int oneShotTimeLimit = 900;
        public static bool debug = false;

        public static int selectedPanel = LIBRARY;
        public static int[] selectedControl;
        public static int zoomedPanel = NONE;

        public static int SNAP_OFF = 0;
        public static int SNAP_ON = 1;
        public static double SNAP_ON_BEAT = 0;
        public static double SNAP_ON_4 = 4;
        public static double SNAP_ON_8 = 8;
        public static double SNAP_ON_16 = 16;
        public static double SNAP_OFF_0_5 = 0.5;
        public static double SNAP_OFF_1 = 1;
        public static double SNAP_OFF_2 = 2;
        public static int snapStatus = SNAP_ON;
        public static double[] snapValue;
        

        #region AppCreation
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            if (Util.debug)
                Application.Run(new testForm());
            else
               // Application.Run(new Deck());
            //Application.Run(new FormMain());
                //Application.Run(new PlayList());
              // Application.Run(new prueba());
            Application.Run(new frmMain());
          //      Application.Run(new Indicators());
        }
        #endregion

        public static void init()
        {
            selectedControl = new int[5];
            selectedControl[DECK_A] = DECK_WAVE_SCROLL;
            selectedControl[DECK_B] = DECK_WAVE_SCROLL;
            selectedControl[LIBRARY] = LIBRARY_SELECTED;
            selectedControl[INDICATORS] = INDICATORS_2_FINGERS_EFFECT;
            selectedControl[RIBBON] = RIBBON_MUSIC;

            panelForm = new Form[selectedControl.Length];

            panelControllingType = new int[selectedControl.Length];
            panelControllingType[DECK_A] = CHANGE_CONTROL_WITH_UP_DOWN;
            panelControllingType[DECK_B] = CHANGE_CONTROL_WITH_UP_DOWN;
            panelControllingType[LIBRARY] = CHANGE_CONTROL_WITH_LEFT_RIGHT;
            panelControllingType[INDICATORS] = CHANGE_CONTROL_WITH_UP_DOWN;
            panelControllingType[RIBBON] = CHANGE_CONTROL_WITH_LEFT_RIGHT;

            snapValue = new double[2];
            snapValue[SNAP_OFF] = SNAP_OFF_1;
            snapValue[SNAP_ON] = SNAP_ON_8;

            controllContourPosition = new Rectangle[selectedControl.Length][];
            controllContourPosition[DECK_A] = new Rectangle[5];
            controllContourPosition[DECK_A][DECK_WAVE_FULL] = new Rectangle(0, 0, 200, 50);
            controllContourPosition[DECK_A][DECK_WAVE_SCROLL] = new Rectangle(0, 50, 200, 50);
            controllContourPosition[DECK_A][DECK_VOLUME] = new Rectangle(0, 100, 200, 50);
            controllContourPosition[DECK_A][DECK_TEMPO] = new Rectangle(0, 150, 200, 50);
            controllContourPosition[DECK_A][DECK_RATE] = new Rectangle(0, 200, 200, 50);
            controllContourPosition[DECK_B] = new Rectangle[5];
            controllContourPosition[DECK_B][DECK_WAVE_FULL] = new Rectangle(200, 0, 200, 50);
            controllContourPosition[DECK_B][DECK_WAVE_SCROLL] = new Rectangle(200, 50, 200, 50);
            controllContourPosition[DECK_B][DECK_VOLUME] = new Rectangle(200, 100, 200, 50);
            controllContourPosition[DECK_B][DECK_TEMPO] = new Rectangle(200, 150, 200, 50);
            controllContourPosition[DECK_B][DECK_RATE] = new Rectangle(200, 200, 200, 50);
            controllContourPosition[LIBRARY] = new Rectangle[4];
            controllContourPosition[LIBRARY][LIBRARY_CATEGORY] = new Rectangle(400, 0, 200, 50);
            controllContourPosition[LIBRARY][LIBRARY_CATEGORY_SONGS] = new Rectangle(400, 50, 200, 50);
            controllContourPosition[LIBRARY][LIBRARY_SELECTED] = new Rectangle(400, 100, 200, 50);
            controllContourPosition[LIBRARY][LIBRARY_SEARCH] = new Rectangle(400, 150, 200, 50);
            controllContourPosition[INDICATORS] = new Rectangle[13];
            controllContourPosition[RIBBON] = new Rectangle[6];

        }


    }
}
